package com.carey.blog.framework.latke.service;

import java.util.Map;

import org.json.JSONObject;


/**
 * Abstract service.
 * 
 */
public abstract class AbstractService {

	/**
	 * Creates data in database with the specified input.
	 * 
	 * @param input
	 *            the specified input
	 * @return creation result
	 * @throws ServiceException
	 *             service exception
	 */
	public JSONObject create(final JSONObject input) throws ServiceException {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	/**
	 * Counts with the specified input.
	 * 
	 * @param input
	 *            the specified input
	 * @return the size of the specified entities. For example:
	 * 
	 *         <pre>
	 * {
	 *     "logsSize": 12
	 * }
	 * </pre>
	 * @throws ServiceException
	 *             service exception
	 */
	public JSONObject count(final JSONObject input) throws ServiceException {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	/**
	 * Retrieves data with the specified input.
	 * 
	 * @param input
	 *            the specified input
	 * @return retrieved data, if not found the data, returns a new(empty)
	 *         result set
	 * @throws ServiceException
	 *             service exception
	 */
	public JSONObject retrieve(final JSONObject input) throws ServiceException {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	/**
	 * Updates data with the specified input.
	 * 
	 * @param input
	 *            the specified input
	 * @return updating result
	 * @throws ServiceException
	 *             service exception
	 */
	public JSONObject update(final JSONObject input) throws ServiceException {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	/**
	 * Deletes data with the specified input.
	 * 
	 * @param input
	 *            the specified input
	 * @return deleting result
	 * @throws ServiceException
	 *             service exception
	 */
	public JSONObject delete(final JSONObject input) throws ServiceException {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	/**
	 * Determins the specified input exists in database or not.
	 * 
	 * @param input
	 *            the specified input
	 * @return {@code true} if exists, otherwise, returns {@code false}
	 * @throws ServiceException
	 *             service exception
	 */
	public boolean exist(final JSONObject input) throws ServiceException {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	/**
	 * Fills <a href="http://www.freemarker.org">FreeMarker</a> template by the
	 * specified data model.
	 * 
	 * @param dataModel
	 *            the specified data model
	 * @throws ServiceException
	 *             service exception
	 */
	public void fill(final Map<String, Object> dataModel)
			throws ServiceException {
		throw new UnsupportedOperationException("Not supported yet.");
	}
}
